<?php
require_once '../includes/include_dao.php';

if ($_GET['action'] == 'delete' && !empty($_GET['template'])) :

	DAOFactory::getTemplateDAO()->delete($_GET['template']); 
	DAOFactory::getTagDAO()->deleteByTemplate($_GET['template']);
	$url = '/templates.php?action=delete&template=' . $_GET['template'];

else :

	$url = '/templates.php?action=error&template=' . $_GET['template'];

endif;

header(sprintf('Location: %s', $url));
?>
